package com.xiaomage.slide;

import android.app.ActivityManager;
import android.content.Context;
import android.util.Log;


/**
 * Created by 赵理想 on 2017/8/3 13:53
 * 邮箱：1782980833@qq.com
 * 联系电话：18321859453
 */

public class ForLog {
    public static void showError(String message){
        if(message==null) return;
        Log.i("9私聊测试专用log",message);
    }
    public static void showError(String message, Context context){
        if(message==null) return;
        Log.i("9私聊测试专用log--"+"线程名-->"+getCurProcessName(context),message);
    }
    public static String getCurProcessName(Context context) {
        int pid = android.os.Process.myPid();
        ActivityManager mActivityManager = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningAppProcessInfo appProcess : mActivityManager
                .getRunningAppProcesses()) {
            if (appProcess.pid == pid) {
                return appProcess.processName;
            }
        }
        return null;
    }

    public static void i(String tag, String msg){
        showError(tag+"()"+msg);
    }
    public static void e(String tag, String msg){
        showError(tag+"()"+msg);
    }
    public static void w(String tag, String msg){
        showError(tag+"()"+msg);
    }
}
